Copyright: Polar Spell Checker © 1998


About Polar SpellChecker

Polar SpellChecker is a tool that allows you to add spell checking to your application with a minimum of programming. It is now available in form of ActiveX control (OCX) and dynamic-link library (DLL).

Polar SpellChecker is primarily a tool for adding spell checking functionality to a higher-level application. Using it is a matter of passing in word for spell checking. Standard features include:

•	Multiple dictionaries available:

•	Danish

•	Dutch

•	French

•	German

•	Italian

•	Latin

•	Spanish

•	Swedish

•	US English

You can switch between dictionaries at runtime.

•	Ignore All	When one of these words appears in a spell check, Polar SpellChecker automatically ignores that word.

•	Change All	When one of these words appears in a spell check, Polar SpellChecker automatically returns selected replacement on GetReplacement.

•	Using fuzzy logic for selecting suggestions.

•	Spell dictionary maker that allows you to create dictionaries from your own wordlists.

•	Multiple custom dictionaries. You can add words to custom dictionaries during a spell check.

This help will introduce you all functions that Polar SpellChecker DLL can perform and all properties and methods contained in Polar SpellChecker OCX.


Technical Support

If you need help using Polar SpellChecker, contact Polar in any of the following ways:

•	visit our home page at	www.polarsoftware.com.

•	E-mail:	support@polarsoftware.com	or

info@polarsoftware.com.


Using Polar Spell Checker with Microsoft Visual Basic
Using Polar SpellChecker with Microsoft Visual Basic 5.0

Adding POLAR SpellChecker control to Toolbox:

From "Project" menu select "Components…" or press Ctrl + T

In "Components" dialog find "POLAR SpellChecker ActiveX Control module" in the list

Select it and click checkbox next to it

Click "Apply" and then "OK" to close dialog

Now there will be new icon for POLAR SpellChecker in the toolbox

Using POLAR SpellChecker control

1. Create new standard project

2. Insert POLAR SpellChecker component into the form

3. Create five buttons and change their caption to "Open Dictionary", "About", "IsWordExist", "GetSuggestion", "AddWord"

4. Create one text box

5. Create one list box

6. Create one label

7. For button "Open Dictionary" put this code:

SpellChecker1.OpenDictionary "c:\MyApp\english.lex", "c:\MyApp\custom.dic"

( for lex file put any dictionary that You have )

8. For button "About" put this code:

SpellChecker1.AboutBox

9. For button "IsWordExist" put this code:

If (SpellChecker1.IsWordExist(Text1.Text)) Then

    Label1.Caption = "Exists"

Else

    Label1.Caption = "Doesn't exist"

End If

10. For button "GetSuggestion" put this code:

Dim Str As String

Dim count As Integer

List1.Clear

count = 0

Do

     Str = SpellChecker1.GetSuggestion(Text1.Text, count)

     count = count + 1

     If Str <> "" Then

         List1.AddItem Str

     End If

Loop Until Str = ""

11. For button "AddWord" put this code:

SpellChecker1.AddWord Text1.Text

12. Run application

13. Click "Open Dictionary"

14. Click "About"

15. Write a word in text box

16. Click "IsWordExist"

If word exist, label will be "Exists"

If word doesn't exist, label will be "Doesn’t Exist"

17. Click "GetSuggestion"

There will be list of suggestions for that word in list-box

18. Write non existing word in textbox

19. Click "IsWordExist"

label will be "Doesn’t Exist"

20. Click "AddWord"

21. Click "IsWordExist"

label will be "Exists"


Using Polar Spell Checker with Microsoft Visual C
Using Polar SpellChecker with Microsoft Visual C 5.0

Adding POLAR SpellChecker control:

From "Project" menu select "Add To Project" / "Components and Controls"

In "Registered ActiveX Controls" directory select "POLAR SpellChecker Control"

Click button "Insert"

Click "OK" on next dialogs

Now there will be new icon for POLAR SpellChecker in the "Controls" palette

Using POLAR SpellChecker control

1. Create new MFC AppWizard project ( Dialog Based )

2. Insert POLAR SpellChecker component into the form

3. Create five buttons and change their caption to "Open Dictionary", "About", "IsWordExist", "GetSuggestion", "AddWord"

4. Create one edit box

5. Create one list box

6. Create one static and change its ID to IDC_STATIC_TEXT

7. Add member variable (Category: control) for SpellChecker control and name it m_SpellChecker

8. Add member variable (Category: Value, Variable Type: CString) for edit box and name it m_edit

9. Add member variable (Category: Value, Variable Type: CString) for static and name it m_static

10. Add member variable (Category: control) for list-box control and name it m_listbox

11. For button "Open Dictionary" put this code:

m_SpellChecker.OpenDictionary("c:\MyApp\english.lex", "c:\MyApp\custom.dic");

( for lex file put any dictionary that You have )

12. For button "About" put this code:

m_SpellChecker.AboutBox();

13. For button "IsWordExist" put this code:

UpdateData(TRUE);

if( m_SpellChecker.IsWordExist(m_edit) )

m_static = "Exists";

else

m_static = "Doesn't Exist";

UpdateData(FALSE);

14. For button "GetSuggestion" put this code:

UpdateData(TRUE);

CString strSuggestion;

INT nCount = 0;

m_listbox.ResetContent();

do{

  strSuggestion = m_SpellChecker.GetSuggestion(m_edit, nCount);

  nCount++;

  if (strSuggestion != "")

      m_listbox.AddString(strSuggestion);

}while( !(strSuggestion == "") );

15. For button "AddWord" put this code:

UpdateData(TRUE);

m_SpellChecker.AddWord(m_edit);

16. Run application

17. Click "Open Dictionary"

18. Click "About"

19. Write a word in edit box

20. Click "IsWordExist"

If word exist, static will be "Exists"

If word doesn't exist, static will be "Doesn’t Exist"

21. Click "GetSuggestion"

There will be list of suggestions for that word in list-box

22. Write non existing word in edit box

23. Click "IsWordExist"

static will be "Doesn’t Exist"

24. Click "AddWord"

25. Click "IsWordExist"

static will be "Exists"


Using Polar SpellChecker with Borland C++ Builder 1.0

Adding POLAR SpellChecker control to tool palette:

From "Component" menu select "Install…"

In "Install Components" dialog click "ActiveX" button

Find "POLAR SpellChecker ActiveX Control module" in the list and select it

Click "OK" on both dialogs

Now there will be new icon for POLAR SpellChecker in the palette (Active X)

Using POLAR SpellChecker control

1. Create new project

2. Insert POLAR SpellChecker component into the form

3. Create five buttons and change their caption to "Open Dictionary", "About", "IsWordExist", "GetSuggestion", "AddWord"

4. Create one edit box

5. Create one list box

6. Create one label

7. For button "Open Dictionary" put this code:

SpellChecker1->Delphi := TRUE;

SpellChecker1->OpenDictionary("c:\\s\\US.lex", "c:\\s\\custom.dic");

( for lex file put any dictionary that You have )

8. For button "About" put this code:

SpellChecker1->AboutBox();

9. For button "IsWordExist" put this code:

if( SpellChecker1->IsWordExist(Edit1->Text) )

Label1->Caption = "Exists";

else

Label1->Caption = "Doesn't Exist";

10. For button "GetSuggestion" put this code:

String strSuggestion;

short nCount = 0;

ListBox1->Clear();

do{

  strSuggestion = SpellChecker1->GetSuggestion(Edit1->Text, nCount);

  nCount++;

  if (strSuggestion != "")

      ListBox1->Items->Add(strSuggestion);

}while( !(strSuggestion == "") );

11. For button "AddWord" put this code:

SpellChecker1->AddWord(Edit1->Text);

12. Run application

13. Click "Open Dictionary"

14. Click "About"

15. Write a word in edit box

16. Click "IsWordExist"

If word exist, label will be "Exists"

If word doesn't exist, label will be "Doesn’t Exist"

17. Click "GetSuggestion"

There will be list of suggestions for that word in list-box

18. Write non existing word in edit box

19. Click "IsWordExist"

label will be "Doesn’t Exist"

20. Click "AddWord"

21. Click "IsWordExist"

label will be "Exists"


Using Polar Spell Checker with Borland Delphi 3
Using Polar SpellChecker with Borland Delphi 3.0

Adding POLAR SpellChecker control to tool palette:

From "Component" menu select "Import ActiveX Control…"

Find "POLAR SpellChecker ActiveX Control module" in the list and select it

Click "Install"

Click "OK"  in "Install" dialog

Click "OK"  for rebuilding

Close "Package" dialog and save changes

Now there will be new icon for POLAR SpellChecker in the palette (Active X)

Using POLAR SpellChecker control

1. Create new project

2. Insert POLAR SpellChecker component into the form

3. Create five buttons and change their caption to "Open Dictionary", "About", "IsWordExist", "GetSuggestion", "AddWord"

4. Create one edit box

5. Create one list box

6. Create one label

7. For button "Open Dictionary" put this code:

SpellChecker1.Delphi := TRUE;

SpellChecker1.OpenDictionary('c:\s\US.lex','c:\s\custom.dic');

( for lex file put any dictionary that You have )

8. For button "About" put this code:

SpellChecker1.AboutBox;

9. For button "IsWordExist" put this code:

if( SpellChecker1.IsWordExist(Edit1.Text) ) then

Label1.Caption := 'Exists'

else

Label1.Caption := 'Doesn't Exist';

10. For button "GetSuggestion" put this code:

var strSuggestion:widestring;

    nCount: smallint;

begin

nCount := 0;

ListBox1.Clear();

repeat

  strSuggestion := SpellChecker1.GetSuggestion(Edit1.Text, nCount);

  nCount := nCount + 1;

  if (strSuggestion <> '') then

      ListBox1.Items.Add(strSuggestion);

until( strSuggestion = '' );

end;

11. For button "AddWord" put this code:

SpellChecker1.AddWord(Edit1.Text);

12. Run application

13. Click "Open Dictionary"

14. Click "About"

15. Write a word in edit box

16. Click "IsWordExist"

If word exist, label will be "Exists"

If word doesn't exist, label will be "Doesn’t Exist"

17. Click "GetSuggestion"

There will be list of suggestions for that word in list-box

18. Write non existing word in edit box

19. Click "IsWordExist"

label will be "Doesn’t Exist"

20. Click "AddWord"

21. Click "IsWordExist"

label will be "Exists"


OpenDictionary
BOOL OpenDictionary(LPCTSTR pszMainDictFileName, LPCTSTR pszCustomDictFileName)

Visual Basic:	OpenDictionary String, String

Borland Delphi :	OpenDictionary( WideString, WideString)

Borland C++ Builder:	VARIANT_BOOL OpenDictionary(BSTR pszMainDictFileName, BSTR pszCustomDictFileName

pszMainDictFileName	pointer to a string that holds name of main dictionary

pszCustomDictFileName	pointer to a string that holds name of custom dictionary

Return Value

TRUE	Opening was successful

FALSE	Opening was not successful

Remarks

Opens main and custom dictionary. If custom dictionary does not exist, it will be created.

If pszMainDictFileName or  pszCustomDictFileName is not full path, path of directory where OCX is located will be added. This method must be called before using any other method.

See also

CloseDictionary


CloseDictionary
void CloseDictionary()

Visual Basic:	CloseDictionary

Borland Delphi :	CloseDictionary

Borland C++ Builder:	void CloseDictionary(void)

Remarks

Closes active dictionary and frees memory. It is not necessary  to call this method, because dictionary will be automatically closed when program ends or if another dictionary is opened with OpenDictionary.

See also

OpenDictionary


IsWordExist
BOOL IsWordExist (LPCTSTR pszWord)

Visual Basic:	IsWordExist  String

Borland Delphi :	IsWordExist( WideString)

Borland C++ Builder:	VARIANT_BOOL:IsWordExist(BSTR pszWord)

pszWord	pointer to a string that holds the word

Return Value

TRUE	word exists

FALSE	word does not exist

Remarks

Use this method to see if word exists in currently opened dictionary (including custom dictionary)

See also

GetSuggestion


GetSuggestion
BSTR GetSuggestion (LPCTSTR pszWord, short nSuggestionIndex)

Visual Basic:	GetSuggestion String, Integer

Borland Delphi :	GetSuggestion( WideString, Smallint)

Borland C++ Builder:	BSTR GetSuggestion(BSTR pszWord, short nSuggestionIndex)

pszWord	pointer to a string that holds the word

nSuggestionIndex	index number of suggestion

Return Value

suggestion word

Remarks

Use this method to get suggestions for word. To get all suggestions loop nSuggestionIndex from 0, and increase it until empty string is returned.

See also

IsWordExist

GetReplacement


AddWord
void AddWord (LPCTSTR pszNewWord)

Visual Basic:	AddWord String

Borland Delphi :	AddWord( WideString)

Borland C++ Builder:	void AddWord(BSTR pszNewWord)

pszNewWord	pointer to a string that holds the word

Remarks

Use this method to add new word to custom dictionary

See also

AddToChangeAll

GetReplacement


AddToChangeAll
void AddToChangeAll (LPCTSTR pszFind, LPCTSTR pszReplace)

Visual Basic:	AddToChangeAll String, String

Borland Delphi :	AddToChangeAll( WideString, WideString)

Borland C++ Builder:	void AddToChangeAll(BSTR pszFind, BSTR pszReplace)

pszFind	pointer to a string that holds the word that will be replaced

pszReplace	pointer to a string that holds the word that will be used as replacement

Remarks

Use this method to add word for automatic replacement ( Change All ). Replacement word will be returned with method GetReplacement.

See also

AddWord

GetReplacement

AddToIgnoreAll


GetReplacement
BSTR GetReplacement (LPCTSTR pszWord)

Visual Basic:	GetReplacement String

Borland Delphi :	GetReplacement( WideString )

Borland C++ Builder:	BSTR GetReplacement(BSTR pszWord)

pszWord	pointer to a string that holds the word

Return Value

replacement word or empty string if there is no replacement

Remarks

Use this method to get replacement for word that was added using AddToChangeAll method. This method should be used before GetSuggestion to check if word was added for Change All.

See also

AddToChangeAll

GetSuggestion


CheckText
BSTR CheckText (LPCTSTR pszText, short *nExitStatus)

Visual Basic:	CheckText(pszText As String, nExitStatus As Integer)

Borland Delphi :	function CheckText(const Wide String pszText; var nExitStatus : SmallInt) : WideString

Borland C++ Builder:	BSTR CheckText(BSTR pszText, short* nExitStatus)

pszText	Specifies the text to be checked.

nExitStatus	Returns error status:

-1	Error, dictionary has not been opened.

0	String has been checked.

1	User has clicked Cancel button in the Spelling Checker dialog-box.

Return Value

Returns checked text with wanted exchanges.

Remarks

Use this method to check written text with options for suggesting words (AlwaysSuggest) and ignoring words with numbers (IgnoreWordsWithNumbers) and words in uppercase (IgnoreWordsInUppercase). This method has three exit statuses. One of them is status of proper spell checking and other two appear when spell checking is skipped. Spell checking can be skipped if the dictionary is not opened or if user cancels spell checking. In those cases nExitStatus will contain nonzero value.

Example

The following example checks the content of a text box.

   Dim Result As Integer

   If SpellChecker1.OpenDictionary("c:\xxx\spellus.lex", "custom.dic") Then

      CheckedText = SpellChecker1.CheckText(Text1.Text, Result)

      Text1.Text = CheckedText

   Else

      MsgBox "Cannot open dictionary"

   End If


CheckTextVBS
BSTR CheckTextVBS (LPCTSTR pszText)

Visual Basic:	Function CheckTextVBS(pszText As String) As String

Borland Delphi :	function CheckTextVBS(String pszText) : WideString

Borland C++ Builder:	BSTR CheckTextVBS(BSTR pszText)

pszText	Specifies the text to be checked.

Return Value

Returns checked text with wanted exchanges.

Remarks

Use this method to check written text with options for suggesting words (AlwaysSuggest) and ignoring words with numbers (IgnoreWordsWithNumbers) and words in uppercase (IgnoreWordsInUppercase). Use this method in VBScript instead CheckText, because VBScript does not support passing parameters by reference.

Example

The following example checks the content of a text box.

   Dim Result As Integer

   If SpellChecker1.OpenDictionary("c:\xxx\spellus.lex", "custom.dic") Then

      CheckedText = SpellChecker1.CheckTextVBS(Text1.Text)

      Text1.Text = CheckedText

   Else

      MsgBox "Cannot open dictionary"

   End If


AboutBox
void AboutBox()

Visual Basic:	AboutBox

Borland Delphi :	AboutBox

Borland C++ Builder:	void AboutBox(void)

Remarks

Shows Polar SpellChecker about box.


Reset
BOOL Reset()

Visual Basic:	Reset

Borland Delphi :	Reset

Borland C++ Builder:	VARIANT_BOOL Reset(void)

Return Value

Returns TRUE on success.

Remarks

Use this method to reset opened dictionary. This method will delete contents of buffers storing words added by methods Ignore All, Change All,...This method is substitute for closing and opening dictionary again.


IsCharAlpha
BOOL IsCharAlpha (short ch)

Visual Basic:	IsCharAlpha Integer

Borland Delphi :	IsCharAlpha( Smallint )

Borland C++ Builder:	BOOL IsCharAlpha( short )

ch	char ordinal number ( e.g. A = 65 )

Return Value

TRUE	char is alphabetical

FALSE	char is not alphabetical

Remarks

Use this method to check is character alphabetical

See also

IsCharLower

IsCharUpper


IsCharLower
BOOL IsCharLower(short ch)

Visual Basic:	IsCharLower Integer

Borland Delphi :	IsCharLower( Smallint )

Borland C++ Builder:	BOOL IsCharLower( short )

ch	char ordinal number ( e.g. A = 65 )

Return Value

TRUE	char is lower case

FALSE	char is not lower case

Remarks

Use this method to check is character lower case

See Also

IsCharAlpha

IsCharUpper


IsCharUpper
BOOL IsCharUpper(short ch)

Visual Basic:	IsCharUpper Integer

Borland Delphi :	IsCharUpper( Smallint )

Borland C++ Builder:	BOOL  IsCharUpper( short )

ch	char ordinal number ( e.g. A = 65 )

Return Value

TRUE	char is upper case

FALSE	char is not upper case

Remarks

Use this method to check is character upper case

See also

IsCharAlpha

IsCharLower


AddToIgnoreAll
void AddToIgnoreAll (LPCTSTR pszWord)

Visual Basic:	AddToIgnoreAll String

Borland Delphi :	AddToIgnoreAll( WideString)

Borland C++ Builder:	void AddToIgnoreAll(BSTR pszWord)

pszWord	pointer to a string that holds the word

Remarks

Use this method to add word to ignore list

See also

AddToChangeAll


GetLanguageName
BSTR GetLanguageName(LPCTSTR pszFileName)

Visual Basic:	GetLanguageName String

Borland Delphi :	GetLanguageName( WideString)

Borland C++ Builder:	BSTR GetLanguageName(BSTR pszDictFileName)

pszFileName	pointer to a string that holds the name of dictionary. If full path is not specified than directory of OCX will be used.

Return Value

name of the language in dictionary or empty string if file was not found.

Remarks

Use this method to get full name of language in dictionary specified by pszFileName


Delphi
void SetDelphi(BOOL bNewValue)

BOOL GetDelphi()

Borland Delphi:	Delphi

bNewValue	new state for "Delphi" property

Remarks

Use this property for checking or setting if working environment is Borland Delphi.

In Delphi add line to your code to set this property to TRUE:

SpellChecker1.Delphi := TRUE;

before using any other method. In other developing environments this property does not need to be changed.


AlwaysSuggest
void SetAlwaysSuggest(BOOL bNewValue)

BOOL GetAlwaysSuggest()

Visual Basic:	AlwaysSuggest

Borland Delphi :	AlwaysSuggest

Borland C++ Builder:	AlwaysSuggest()

bNewValue	new state for AlwaysSuggest property

Return Value

TRUE	SpellChecker will generate a list of suggested corrections for each unmatched word

FALSE	SpellChecker will not make suggestions

Remarks

This property defines if a list of suggested corrections for each unmatched word will be displayed when user checks spelling. It influences only while using CheckText method. Default value of this property is TRUE and can be changed in a dialog-box.


IgnoreWordsInUppercase
void SetIgnoreWordsInUppercase(BOOL bNewValue)

BOOL GetIgnoreWordsInUppercase()

Visual Basic:	IgnoreWordsInUppercase

Borland Delphi :	IgnoreWordsInUppercase

Borland C++ Builder:	IgnoreWordsInUppercase()

bNewValue	new state for IgnoreWordsInUppercase property

Return Value

TRUE	words written in uppercase will be ignored

FALSE	words written in uppercase will not be ignored

Remarks

This property defines if words in which each character is an uppercase letter will be ignored. It influences only while using CheckText method. Default value of property IgnoreWordsInUppercase is TRUE and can be changed in a dialog-box..

See also

IgnoreWordsWithNumbers


IgnoreWordsWithNumbers
void SetIgnoreWordsWithNumbers(BOOL bNewValue)

BOOL GetIgnoreWordsWithNumbers()

Visual Basic:	IgnoreWordsWithNumbers

Borland Delphi :	IgnoreWordsWithNumbers

Borland C++ Builder:	IgnoreWordsWithNumbers()

bNewValue	new state for IgnoreWordsWithNumbers property

Return Value

TRUE	words with numbers will be ignored

FALSE	words with numbers will not be ignored

Remarks

This property defines if words containing numbers will be ignored. It influences only while using CheckText method. Default value of property IgnoreWordsWithNumbers is TRUE and can be changed in a dialog-box.

See also

IgnoreWordsInUppercase


How to buy Polar SpellChecker

…with credit cards

You may order Polar SpellChecker online with your credit cards (Visa, MasterCard) via secure server at our site:

http://www.polarsoftware.com/products.asp.

or visiting RegSoft.com which will also enable you online registration (Visa, MasterCard, American Express, Discover (Novus)):

https://www.regsoft.com/cgi-bin/reg_it_offsite.pl?7296=REGSOFT.

…by mail:

You may order Polar SpellChecker via mail by U.S. currency check or money.

Send to RegSoft:

RegSoft.com

6595-G Roswell Road

Suite 732

Atlanta, GA 30328

…by phone or fax:

You can make your order via RegSoft by phone at: TOLL FREE phone number 1 - 877 - REGSOFT (international orders please call: 770 - 497 - 9126)

or by  FAX at: 770 - 497 - 9234.

For this kind of order you will need Product ID of Polar SpellChecker which is: 7296.


Polar SpellChecker DLL

Polar SpellChecker DLL package consists of following files:

Polspell.Dll - dynamic-link library (DLL)

Polspell.Lib - Visual C++ library file

Polspell.Def - Polspell.Dll definition file

Polspell.H - Header for Polspell.Dll

Mfcspell.H - MFC wrapper for Polspell.Dll

This help includes syntax and definition only for functions declared in Polspell.H header file. If you choose to use Polar SpellChecker using MFC wrapper, use functions declared in Mfcspell.H header file. Those functions have different declaration but definitions and syntax are same as described here.

Example

This example shows how to use PS_CheckText function using DLL APIs and MFC wrapper.

void CTestDLLDlg::OnBtnSpell()

{

char szText[10240];

// using DLL APIs

if(GetDlgItemText(IDC_EDIT_TEXT, szText, 10240) > 0)

{

HSPELL hSpell = PS_Init();

if(PS_OpenDictionary(hSpell, "spellus.lex", "custom.dic"))

{

short nError;

HGLOBAL hglb = PS_CheckText(hSpell, szText, &nError);

if(hglb)

{

LPTSTR pszChecked = (LPTSTR)GlobalLock(hglb);

if(pszChecked)

{

SetDlgItemText(IDC_EDIT_CHECKED, pszChecked);

}

GlobalUnlock(hglb);

GlobalFree(hglb);

}

PS_CloseDictionary(hSpell);

}

PS_Destroy(hSpell);

}

// using MFC wrapper

if(GetDlgItemText(IDC_EDIT_TEXT, szText, 10240) > 0)

{

TSpellingChecker SpellCheck;

if(SpellCheck.OpenDictionary("spellus.lex", "custom.dic"))

{

short nError;

CString strCheckedText = SpellCheck.CheckText(szText, &nError);

SetDlgItemText(IDC_EDIT_CHECKED_MFC, strCheckedText);

SpellCheck.CloseDictionary();

}

}


PS_AddToChangeAll

void PS_AddToChangeAll(HSPELL hSpell, LPCTSTR pszFind, LPCTSTR pszReplace)

Use this function to add word for automatic replacement (Change All). Replacement word will be returned with PS_GetReplacement function.

Parameters

hSpell

handle to spelling checker

pszFind

pointer to a string that holds the word that will be replaced

pszReplace

pointer to a string that holds the word that will be used as replacement


PS_AddToIgnoreAll

void PS_AddToIgnoreAll(HSPELL hSpell, LPCTSTR pszWord)

Use this function to add word to ignore list.

Parameters

hSpell

handle to spelling checker

pszWord

pointer to a string that holds the word


PS_AddWord

void PS_AddWord(HSPELL hSpell, LPCTSTR pszNewWord)

Use this function to add new word to custom dictionary.

Parameters

hSpell

handle to spelling checker

pszNewWord

pointer to a string that holds the word

See Also

PS_AddToChangeAll

PS_GetReplacement


PS_CheckText

HGLOBAL PS_CheckText(HSPELL hSpell, LPCTSTR pszText, short * nExitStatus)

Use this function to check written text with options for suggesting words (PS_GetAlwaysSuggest, PS_SetAlwaysSuggest) and ignoring words with numbers (PS_GetIgnoreWordsWithNumbers, PS_SetIgnoreWordsWithNumbers) and words in uppercase (PS_GetIgnoreWordsInUppercase, PS_SetIgnoreWordsInUppercase). This function has three exit statuses. One of them is status of proper spell checking and other two appear when spell checking is skipped. Spell checking can be skipped if the dictionary is not opened or if user cancels spell checking. In those cases nExitStatus parameter will contain nonzero value.

Return Value

Returns handle to global memory which contains checked text, or NULL on error/empty string.

Parameters

hSpell

handle to spelling checker

pszText

text to be checked

nExitStatus

Returns error status:
 -1  Error, dictionary has not been opened.
 0  String has been checked.
 1  User has clicked Cancel button in the Spelling Checker dialog-box.


PS_CloseDictionary

void PS_CloseDictionary(HSPELL hSpell)

Closes the active dictionary and frees memory. It is not necessary to call this function, because dictionary will be automatically closed when you call PS_Destroy function or if another dictionary is opened with PS_OpenDictionary.

Parameters

hSpell

handle to spelling checker


PS_Destroy

void PS_Destroy(HSPELL hSpell)

The PS_Destroy function deletes spelling checker instance created with PS_Init  function.

Parameters

hSpell

handle to spelling checker


PS_GetAlwaysSuggest

BOOL PS_GetAlwaysSuggest(HSPELL hSpell)

Returns nonzero value if a list of suggested corrections for each unmatched word will be displayed when user checks spelling. It influences only while using PS_CheckText function.

Parameters

hSpell

handle to spelling checker

See Also

PS_SetAlwaysSuggest


PS_GetIgnoreWordsInUppercase

BOOL PS_GetIgnoreWordsInUppercase(HSPELL hSpell)

Returns nonzero value if words in which each character is an uppercase letter will be ignored. It influences only while using  function.

Default value of this option is TRUE and can be changed in a dialog-box.

Parameters

hSpell

handle to spelling checker

See Also

PS_SetIgnoreWordsInUppercase


PS_GetIgnoreWordsWithNumbers

BOOL PS_GetIgnoreWordsWithNumbers(HSPELL hSpell)

Returns nonzero value if words containing numbers will be ignored. It influences only while using  function.

Default value of this option is TRUE and can be changed in a dialog-box.

Parameters

hSpell

handle to spelling checker

See Also

PS_SetIgnoreWordsWithNumbers


PS_GetLanguageName

BOOL PS_GetLanguageName(HSPELL hSpell, LPCTSTR pszDictFileName, LPTSTR pszLangName, unsigned nSize)

Use this function to get full name of language in dictionary specified by pszDictFileName.

Return Value

Returns nonzero value on success.

Parameters

hSpell

handle to spelling checker

pszDictFileName

pointer to a string that holds the name of dictionary

pszLangName

Points to the buffer that is to receive the null-terminated language name.

nSize

Specifies the maximum number of bytes to copy, including the terminating null character.


PS_GetReplacement

BOOL PS_GetReplacement(HSPELL hSpell, LPCTSTR pszWord, LPTSTR pszReplacement, unsigned nSize)

Use this function to get replacement for word that was added using PS_AddToChangeAll function. This function should be used before PS_GetSuggestion to check if word was added for Change All.

Return Value

Returns zero if there is no replacement for that word.

Parameters

hSpell

handle to spelling checker

pszWord

pointer to a string that holds the word

pszReplacement

Points to the buffer that is to receive the null-terminated replacement string.

nSize

Specifies the maximum number of bytes to copy, including the terminating null character.

See Also

PS_AddToChangeAll

PS_GetSuggestion


PS_GetSuggestion

BOOL PS_GetSuggestion(HSPELL hSpell, LPCTSTR pszWord, short nSuggestionIndex, LPTSTR pszSuggestion, unsigned nSize)

Use this function to get suggestions for word. To get all suggestions, loop nSuggestionIndex from 0, and increase it until FALSE is returned.

Parameters

hSpell

handle to spelling checker

pszWord

pointer to a string that holds the word

nSuggestionIndex

zero based index number of suggestion

pszSuggestion

Points to the buffer that is to receive the null-terminated suggestion string.

nSize

Specifies the maximum number of bytes to copy, including the terminating null character.


PS_Init

HSPELL PS_Init(void)

The PS_Init function creates new spelling checker instance. After this function you must call PS_OpenDictionary function.

Return Value

Handle of the spelling checker


PS_IsCharAlpha

BOOL PS_IsCharAlpha(HSPELL hSpell, short ch)

Use this function to check if character is alphabetical.

Return Value

Returns nonzero if a character is alphabetical.

Parameters

hSpell

handle to spelling checker

ch

character to test


PS_IsCharLower

BOOL PS_IsCharLower(HSPELL hSpell, short ch)

Returns nonzero if a character is lowercase.

Parameters

hSpell

handle to spelling checker

ch

character to test


PS_IsCharUpper

BOOL PS_IsCharUpper(HSPELL hSpell, short ch)

Returns nonzero if a character is uppercase.

Parameters

hSpell

handle to spelling checker

ch

character to test


PS_IsWordExist

BOOL PS_IsWordExist(HSPELL hSpell, LPCTSTR pszWord)

Use this function to see if word exists in currently opened dictionary (including custom dictionary).

Return Value

Returns nonzero value if word exists.

Parameters

hSpell

handle to spelling checker

pszWord

pointer to a string that holds the word


PS_OpenDictionary

BOOL PS_OpenDictionary(HSPELL hSpell, LPCTSTR pszMainDictFileName, LPCTSTR pszCustomDictFileName)

Opens main and custom dictionary. If custom dictionary does not exist, it will be created. This function must be called before using any other function.

Return Value

Returns nonzero value on success.

Parameters

hSpell

handle to spelling checker (see PS_Init)

pszMainDictFileName

pointer to a string that holds name of main dictionary

pszCustomDictFileName

pointer to a string that holds name of custom dictionary

See Also

PS_CloseDictionary

PS_Init


PS_Reset

BOOL PS_Reset(HSPELL hSpell)

Use this method to reset opened dictionary. This method will delete contents of buffers storing words added by IgnoreAll, ChangeAll,... This method is substitute for closing and opening dictionary again.

Parameters

hSpell

handle to spelling checker

Return Value

Returns nonzero value on success.

See Also

PS_OpenDictionary

PS_CloseDictionary


PS_SetAlwaysSuggest

void PS_SetAlwaysSuggest(HSPELL hSpell, BOOL bNewValue)

Sets Always Suggest option.

Parameters

hSpell

handle to spelling checker

bNewValue

Specifies Always Suggest option. This parameter must be TRUE or FALSE.

See Also

PS_GetAlwaysSuggest


PS_SetIgnoreWordsInUppercase

void PS_SetIgnoreWordsInUppercase(HSPELL hSpell, BOOL bNewValue)

Sets Ignore Words in Uppercase option.

Parameters

hSpell

handle to spelling checker

bNewValue

Specifies Ignore Words in Uppercase option. This parameter must be TRUE or FALSE.

See Also

PS_GetIgnoreWordsInUppercase


PS_SetIgnoreWordsWithNumbers

void PS_SetIgnoreWordsWithNumbers(HSPELL hSpell, BOOL bNewValue)

The PS_SetIgnoreWordsWithNumbers function sets Ignore Words With Numbers option.

Parameters

hSpell

handle to spelling checker

bNewValue

Specifies Ignore Words With Numbers option. This parameter must be TRUE or FALSE.

See Also

PS_GetIgnoreWordsWithNumbers